
module Comparator_Analog
    #(
        parameter iWIDTH=10,
        parameter oWIDTH=32,
        parameter GAIN=512
    )
    (
        input wire signed [iWIDTH-1:0] i_SignalInput,
        input wire signed [iWIDTH-1:0] i_Reference,
        input wire i_clk,
        input wire i_rst,
        output reg signed [oWIDTH-1:0] o_SignalOutput
    );
    wire signed [oWIDTH-1:0] compout;
    assign compout=(i_SignalInput-i_Reference)*GAIN;

    always@(posedge i_clk or posedge i_rst) begin
        if(i_rst) begin
            o_SignalOutput<='b0;
        end
        else begin
            o_SignalOutput<=compout;
        end
    end

endmodule